/*
 * =====================================================================================
 *
 *       Filename:  SyntaxBinTree.cpp
 *
 *    Description:
 *
 *        Version:  1.0
 *        Created:  2017年05月15日 18时31分39秒
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:  Crane (), wanghe@galaxyeye-tech.com
 *   Organization:  Galaxy-eye
 *
 * =====================================================================================
 */


#ifndef  SyntaxBinTree_H_
#define  SyntaxBinTree_H_

#include <string>

class SyntaxBinNode;
typedef SyntaxBinNode * SyntaxBinTree;


class SyntaxBinNode
{
    typedef std::string string;
    typedef SyntaxBinTree  Tree;

public:
    string GetContent() {
        return content_;
    }

    void SetContent(const string & value) {
        content_ = value;
    }

    void SetLeft(Tree tree) {
        leftTree_ = tree;
    }

    void SetRight(Tree tree) {
        rightTree_ = tree;
    }

private:
    string  content_;
    Tree leftTree_;
    Tree rightTree_;
};

class Token
{

    /*
     * 这个文法中: 只有四种符号: "字符串", "左圆括号(", "逗号," , "右圆括号("
     *
     * N → string ( N, N )
     * N → ε
     */

    typedef std::string string;

public:
    enum  TOKEN_TYPE {
        STRING,             // 字符串, 只有字符串类型的 TOKEN, 有content
        LEFT_PAREN,         // 左圆括号
        RIGHT_PAREN,        // 又圆括号
        COMMA               // 逗号
    };

    Token(TOKEN_TYPE type, string content = "") {
        tokenType_ = type;
        content_   = content;
    }

private:
    string     content_;
    TOKEN_TYPE tokenType_;
};

#endif   /* ----- #ifndef SyntaxBinTree_H_  ----- */

